﻿/*
 *
 * Program.cs
 * For Main program in CICI
 * 
 * Author @semarketir
 * 
 * CICI is simple tool for generate Controller, Model, and View in CodeIgniter ( or CI ) Framework
 * CICI can used to setup configurations in CI ( Database, Autoload, Config ) <- Next Version
 * CICI just can to used for default directory of CodeIgniter ( or CI ) Framework
 * 
 * CICI v.0.0.4 Beta
 * 
 * Support with CI 2.X ( or heigh )
 * 
 * License Under GPL
 * 
 * 
 * Salam, 
 * semar ketir
 * 
*/

using System;
using System.Collections.Generic;
using System.Text;

namespace cici
{
    class Program
    {

        static void Main(string[] args)
        {
            Program program = new Program();

            Checking checking = new Checking();

            if (args.Length > 2)
            {
                checking.setArgs(args);
                checking.execute();

                if (checking.getStatus())
                {
                    try
                    {
                        Console.WriteLine("\nCici say : " + checking.getMessage() + "\n");
                    }
                    catch (Exception ex)
                    {
                        ex.Message.ToString();
                        Console.WriteLine("\nCici say error in : " + checking.getMessage() + "\n");
                    }
                }
                else
                {
                    Console.WriteLine("\nCici say : " + checking.getMessage()+ "\n");
                }
            }
            else
            {
                program.help();
            }
        }

        private void help(string messsage="")
        {

            string help = messsage + "\nCodeIgniter ( or CI ) 2.X ( or heigher )\n" +
                "cici version 0.0.5 beta\n" +
                "scripted by @semarketir\n" +
                "\n*cici help\n\n" +


                "*generate controller : \n" +
                "cici create controller controller_name1;folder_name.controller_name2; \n" +

                "\n*generate action : \n" +
                "cici create action controller_name1=action_name1;controller_name1=action_name2;folder_name.controller_name2=action_name1; \n" +

                "\n*generate model : \n" +
                "cici create model model_name1;folder_name.model_name2; \n" +

                "\n*generate model crud : \n" +
                "cici create modelcrud model_crud_name1;folder_name.model_crud_name2; \n" +

                "\n*generate MVC or Model, View and Controller from database : \n" +
                "cici create mvc table_name1;table_name2; \n" +

                "\n*generate MVC or Model, View and Controller from database and all table : \n" +
                "cici create mvc 000; \n" +

                "\n*generate view : \n" +
                "cici create view view_name1;folder_name.view_name2; \n" +

                "\n*configure config : \n" +
                "cici configure config base_url=\"http://localhost/ci\";index_page=\"index.php\"; \n" +

                "\n*configure autoload : \n" +
                "cici configure autoload model=\"my_folder_model/mymodel1\";model=\"mymodel2\";language=\"lang1\"; \n" +

                "\n*configure routes : \n" +
                "cici configure routes default_controller=\"welcome/index\";404_override=\"my_404\"; \n" +

                "\n*configure database : \n" +
                "cici configure database hostname=\"localhost\";username=\"root\";password=\"password\"; \n";


            Console.WriteLine(help);
        }
    }
}
